package com.zhuhaibaoxian.wanjiuseller.retrofit;

import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;


import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by CHENG on 2017/10/29.
 * 數據模型全局類
 */

public class Model {
    private ExecutorService executorService = Executors.newCachedThreadPool();
    private Context mContext;
    public static Model model;

    private Model(){

    }
    public static Model getInstance(){
        if (model==null) {
            model = new Model();
        }
        return model;
    }
    //初始化
    public void init(Context context){
        this.mContext = context;
        //初始化全局事件监听类
    }

    //獲取全局綫程池
    public ExecutorService getGlobalThreadPool(){
        return executorService;
    }

    //显示对话框
    public void showNormalDialog(String msg) {
        final AlertDialog.Builder normalDialog = new AlertDialog.Builder(mContext);
//        normalDialog.setIcon(R.drawable.icon_dialog);
        normalDialog.setTitle("温馨提示");
        normalDialog.setMessage(msg);
        normalDialog.setPositiveButton("确定",
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        //...To-do
                    }
                });
        // 显示
        normalDialog.show();

    }
//

}
